#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#define mm(a) memset(a, 0, sizeof(a))
const int N = 10005; //题目没说多大数据，默认开大点
int path[N], dp[N];
using namespace std;
struct node
{
    int weight, speed, order; //分别代表重量，速度，编号
} mouses[N];
bool cmp(node x, node y)
{
    if (x.weight == y.weight)
        return x.speed < y.speed;
    return x.weight > y.weight;
}
int main()
{
    int sum, step, k, t, book;
    for (int i = 1; i < N; i++) //path先记录自己的编号
        path[i] = i;
    k = 1;
    while (cin >> mouses[k].weight >> mouses[k].speed)
    {
        mouses[k].order = k;
        k++;
    }
    if (k == 2) //Special judge
    {
        cout << 1 << endl
             << 1 << endl;
    }
    else
    {
        sort(mouses + 1, mouses + k, cmp);
        mm(dp);
        sum = 0;
        for (int i = 1; i < k; i++)
        {
            step = 0;
            for (int j = 1; j < i; j++)
            {
                if (mouses[i].weight < mouses[j].weight && mouses[i].speed > mouses[j].speed)
                {
                    if (step < dp[j])
                    {
                        step = dp[j];
                        book = mouses[j].order;
                    }
                }
                if (step)
                    path[mouses[i].order] = book;
                dp[i] = step + 1;
                if (sum < dp[i])
                {
                    sum = dp[i];
                    t = mouses[i].order;
                }
            }
        }
        cout << sum << endl;
        while (path[t] != t) //输出path记录的编号
        {
            cout << t << endl;
            t = path[t];
        }
        cout << t << endl; //最后记录的是自己
    }
    return 0;
}